﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


public class NetEvent_UpdateDiamond : NetEvent
{
    public static NetEvent_UpdateDiamond NewEvent()
    {
        return new NetEvent_UpdateDiamond();
    }

    protected override ISerialize NewData() => new UpdateDiamondData();

    public const int NotSetDiamond = -1;

    /// <summary>
    /// 是否延迟手动更新
    /// </summary>
    public static int toSetDiamond = NotSetDiamond;

    protected override void Excuate(ISerialize data)
    {
        UpdateDiamondData updateData = data as UpdateDiamondData;

        GameDebug.Log($"更新钻石数量：{updateData.diamond} ");// delay:{NumsShowController.delayUpdateNumShow}

        MGame.instance.user.UpdateDiamond(updateData.diamond);

        if (UIController.instance)
        {
            MainPanel main = UIController.instance.GetUI<MainPanel>() as MainPanel;
            main.mePanel.RefreshDiamond(updateData.diamond);
        }
    }

}
